package hk.m4s.lr.repair.test.service.device;

import android.content.Context;

import java.util.Map;

import framework.common.widgets.dialogs.UeDialog;
import framework.common.zanetwork.UeHttpUrl;
import framework.common.zanetwork.core.HttpCallback;
import framework.common.zanetwork.core.ResponseCallback;
import hk.m4s.lr.repair.test.model.CenterMainModelResult;
import hk.m4s.lr.repair.test.model.DeviceModelResult;
import hk.m4s.lr.repair.test.model.DeviceRepalyModelResult;
import hk.m4s.lr.repair.test.model.MainInfoModel;
import hk.m4s.lr.repair.test.model.MaintenModelResult;
import hk.m4s.lr.repair.test.model.MaintenanceInfoModelResult;
import hk.m4s.lr.repair.test.model.MaintenanceModelResult;
import hk.m4s.lr.repair.test.model.MaintenancekModel;
import hk.m4s.lr.repair.test.model.NoticeDeviceModelResult;
import hk.m4s.lr.repair.test.model.UserinfoModel;
import hk.m4s.lr.repair.test.service.BaseService;
import okhttp3.Response;

/**
 * Created by qi.wang on 2017/4/1.
 */

public class DeviceListervice extends BaseService{
    public static void deviceLists (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenanceModelResult> callback) {

        httpHelper.post(UeHttpUrl.deviceList(), parmas, new HttpCallback<MaintenanceModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenanceModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceList (final Context context, Map<String, Object> parmas, final ResponseCallback<DeviceModelResult> callback) {

        httpHelper.post(UeHttpUrl.deviceList(), parmas, new HttpCallback<DeviceModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, DeviceModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void myDeviceList (final Context context, Map<String, Object> parmas, final ResponseCallback<DeviceModelResult> callback) {

        httpHelper.post(UeHttpUrl.myDeviceList(), parmas, new HttpCallback<DeviceModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, DeviceModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void centerCheckMainList (final Context context, Map<String, Object> parmas, final ResponseCallback<CenterMainModelResult> callback) {

        httpHelper.post(UeHttpUrl.centerCheckMainList(), parmas, new HttpCallback<CenterMainModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, CenterMainModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void maintenancekByDeviceId (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenancekModel> callback) {

        httpHelper.post(UeHttpUrl.maintenancekByDeviceId(), parmas, new HttpCallback<MaintenancekModel>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenancekModel o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void checkId (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenancekModel> callback) {

        httpHelper.post(UeHttpUrl.checkByDeviceId(), parmas, new HttpCallback<MaintenancekModel>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenancekModel o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceMaintenanceList (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenanceModelResult> callback) {

        httpHelper.post(UeHttpUrl.deviceMaintenanceList(), parmas, new HttpCallback<MaintenanceModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenanceModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceMaintenanceInfo (final Context context, Map<String, Object> parmas, final ResponseCallback<MainInfoModel> callback) {

        httpHelper.post(UeHttpUrl.deviceMaintenanceInfo(), parmas, new HttpCallback<MainInfoModel>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MainInfoModel o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceCheckInfo (final Context context, Map<String, Object> parmas, final ResponseCallback<MainInfoModel> callback) {

        httpHelper.post(UeHttpUrl.deviceCheckInfo(), parmas, new HttpCallback<MainInfoModel>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MainInfoModel o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void taskByState (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenanceInfoModelResult> callback) {

        httpHelper.post(UeHttpUrl.taskByState(), parmas, new HttpCallback<MaintenanceInfoModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenanceInfoModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceMaintenancePush (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenanceInfoModelResult> callback) {

        httpHelper.post(UeHttpUrl.deviceMaintenancePush(), parmas, new HttpCallback<MaintenanceInfoModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenanceInfoModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceCheckPush (final Context context, Map<String, Object> parmas, final ResponseCallback<MaintenanceInfoModelResult> callback) {

        httpHelper.post(UeHttpUrl.deviceCheckPush(), parmas, new HttpCallback<MaintenanceInfoModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, MaintenanceInfoModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void deviceBusinessList (final Context context, Map<String, Object> parmas, final ResponseCallback<NoticeDeviceModelResult> callback) {

        httpHelper.post(UeHttpUrl.deviceBusinessList(), parmas, new HttpCallback<NoticeDeviceModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, NoticeDeviceModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void businessRreplyList (final Context context, Map<String, Object> parmas, final ResponseCallback<DeviceRepalyModelResult> callback) {

        httpHelper.post(UeHttpUrl.businessRreplyList(), parmas, new HttpCallback<DeviceRepalyModelResult>() {
            @Override
            public void onRequestBefore() {

            }

            @Override
            public void onSuccess(Response response, DeviceRepalyModelResult o) {

                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {

                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void businessOperation (final Context context, Map<String, Object> parmas, final ResponseCallback<Map> callback) {

        httpHelper.post(UeHttpUrl.businessOperation(), parmas, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {
                UeDialog.showprogressDialog(context,"","操作中...",false);
            }

            @Override
            public void onSuccess(Response response, Map o) {
                UeDialog.hideProgress();
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                UeDialog.hideProgress();
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void updateCheckByDeviceId (final Context context, Map<String, Object> parmas, final ResponseCallback<Map> callback) {

        httpHelper.post(UeHttpUrl.updateCheckByDeviceId(), parmas, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {
                UeDialog.showprogressDialog(context,"","操作中...",false);
            }

            @Override
            public void onSuccess(Response response, Map o) {
                UeDialog.hideProgress();
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                UeDialog.hideProgress();
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
    public static void updateMaintenancekByDeviceId (final Context context, Map<String, Object> parmas, final ResponseCallback<Map> callback) {

        httpHelper.post(UeHttpUrl.updateMaintenancekByDeviceId(), parmas, new HttpCallback<Map>() {
            @Override
            public void onRequestBefore() {
                UeDialog.showprogressDialog(context,"","操作中...",false);
            }

            @Override
            public void onSuccess(Response response, Map o) {
                UeDialog.hideProgress();
                callback.onSuccess(o);
            }

            @Override
            public void onError(Response response, int errorCode, Exception e) {
                UeDialog.hideProgress();
                callback.onError(response, errorCode, null, e);

            }

            @Override
            public void onFailure(Response response, String failureMsg, int code) {

                callback.onError(response, code, failureMsg, null);
            }
        });
    }
}
